Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify the logging config so that JSON logging works #456

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

mmwinther
Copy link
Member

@mmwinther mmwinther commented Dec 2, 2024

There was a clash between the Gunicorn config and the in-app config which prevented messages being logged in the specified JSON format. This PR unifies the config such that we log JSON when desired.

Example logs:

{"level": "WARNING", "message": "Thread is not done. Cannot parse xml.", "timestamp": "2024-12-02T14:53:04.608531+00:00", "logger": "dapla_metadata.datasets.statistic_subject_mapping", "module": "statistic_subject_mapping", "function": "_parse_xml_if_loaded", "line": 182, "thread_name": "MainThread"}
{"level": "INFO", "message": "Updated dataset name with value root=[LanguageStringTypeItem(languageCode='nb', languageText='my file')]", "timestamp": "2024-12-02T14:53:31.485456+00:00", "logger": "datadoc.frontend.callbacks.dataset", "module": "dataset", "function": "accept_dataset_metadata_input", "line": 210, "thread_name": "MainThread"}
{"level": "WARNING", "message": "Was not possible to retrieve user information! Some fields may not be set.", "timestamp": "2024-12-02T14:53:31.588919+00:00", "logger": "dapla_metadata.datasets.user_info", "module": "user_info", "function": "get_user_info_for_current_platform", "line": 85, "thread_name": "MainThread"}

@mmwinther mmwinther requested a review from a team as a code owner December 2, 2024 15:05
Jorgen-5
Jorgen-5 previously approved these changes Dec 2, 2024
Copy link
Contributor

@Jorgen-5 Jorgen-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice changes, looks good!

@mmwinther mmwinther added the bug Something isn't working label Dec 3, 2024
@mmwinther mmwinther merged commit a56201c into master Dec 3, 2024
12 checks passed
@mmwinther mmwinther deleted the fix/logging-config branch December 3, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants